Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle React.ReactChild correctly #402

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

michaelrambeau
Copy link
Contributor

@michaelrambeau michaelrambeau commented Aug 2, 2023

Goal

Altassian Design system uses React.ReactChild for some properties, iconAfter of <Button> component for example: https://atlassian.design/components/button/examples

Currently it does not show up correctly in Merge, a yellow warning is displayed because the type is serialized incorrectly as any,

This PR fixes the behavior to handle React.ReactChild as if it was a React.ReactNode, which is the usual way to handle React nodes.

It requires an upgrade of TypeScript.
I was really surprised that the upgrade of TypeScript didn't break anything 😅 !

This PR includes some refactoring to gather all the tiny functions about types in a single file, because I didn't want to add an extra file just for the new function isAny.

How to test

Run experimental mode from Altassian DS repo: https://github.com/uxpin-merge/atlas-uxpin-merge

Check that both children and icon fields are displayed correctly

Screenshot

image

@Evomatic
Copy link
Contributor

Evomatic commented Aug 3, 2023

I tested the dev package that you released and everything seems to work!
Commands I ran:

  • push
  • experimental
  • dump
  • delete-version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants